* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}
*::after, *::before {
  box-sizing: inherit;
}

body {
  width: 100%;
  height: 100vh;
}

.wrapper {
  width: 400px;
  height: 400px;
  margin: 0 auto;
  margin-top: 50px;
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  grid-template-rows: 1fr 1fr 1fr;
  gap: 10px;
  transition: 0.5s;
}
.wrapper .item:nth-child(1) {
  background-color: hsl(40, 100%, 70%);
}
.wrapper:has(.item:nth-child(1):hover) {
  grid-template-columns: 2fr 1fr 1fr;
  grid-template-rows: 2fr 1fr 1fr;
}
.wrapper .item:nth-child(2) {
  background-color: hsl(80, 100%, 70%);
}
.wrapper:has(.item:nth-child(2):hover) {
  grid-template-columns: 1fr 2fr 1fr;
  grid-template-rows: 2fr 1fr 1fr;
}
.wrapper .item:nth-child(3) {
  background-color: hsl(120, 100%, 70%);
}
.wrapper:has(.item:nth-child(3):hover) {
  grid-template-columns: 1fr 1fr 2fr;
  grid-template-rows: 2fr 1fr 1fr;
}
.wrapper .item:nth-child(4) {
  background-color: hsl(160, 100%, 70%);
}
.wrapper:has(.item:nth-child(4):hover) {
  grid-template-columns: 2fr 1fr 1fr;
  grid-template-rows: 1fr 2fr 1fr;
}
.wrapper .item:nth-child(5) {
  background-color: hsl(200, 100%, 70%);
}
.wrapper:has(.item:nth-child(5):hover) {
  grid-template-columns: 1fr 2fr 1fr;
  grid-template-rows: 1fr 2fr 1fr;
}
.wrapper .item:nth-child(6) {
  background-color: hsl(240, 100%, 70%);
}
.wrapper:has(.item:nth-child(6):hover) {
  grid-template-columns: 1fr 1fr 2fr;
  grid-template-rows: 1fr 2fr 1fr;
}
.wrapper .item:nth-child(7) {
  background-color: hsl(280, 100%, 70%);
}
.wrapper:has(.item:nth-child(7):hover) {
  grid-template-columns: 2fr 1fr 1fr;
  grid-template-rows: 1fr 1fr 2fr;
}
.wrapper .item:nth-child(8) {
  background-color: hsl(320, 100%, 70%);
}
.wrapper:has(.item:nth-child(8):hover) {
  grid-template-columns: 1fr 2fr 1fr;
  grid-template-rows: 1fr 1fr 2fr;
}
.wrapper .item:nth-child(9) {
  background-color: hsl(0, 100%, 70%);
}
.wrapper:has(.item:nth-child(9):hover) {
  grid-template-columns: 1fr 1fr 2fr;
  grid-template-rows: 1fr 1fr 2fr;
}